package com.cloudsigns.factorymanager2.engineering.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.cusenum.CommonEnum;
import com.cloudsigns.factorymanager2.engineering.IView.IEngineeringInstallStatusFormanagerView;
import com.cloudsigns.factorymanager2.engineering.adapter.DropDownPoupWindowAdapter;
import com.cloudsigns.factorymanager2.engineering.adapter.TableContentEngineeringInstallForManagerAdapter;
import com.cloudsigns.factorymanager2.engineering.adapter.TableLeftEngineeringInstallForManagerAdapter;
import com.cloudsigns.factorymanager2.engineering.bean.DailyFeedBackStatuBean;
import com.cloudsigns.factorymanager2.engineering.bean.EngineeringInstallStatuBean;
import com.cloudsigns.factorymanager2.engineering.customview.SpinerPopWindow;
import com.cloudsigns.factorymanager2.engineering.presenter.EngineeringInstallStatusFormanagerPresenter;
import com.cloudsigns.factorymanager2.project.activity.EngineeringInstallationScheduleTableActivity;
import com.cloudsigns.factorymanager2.project.activity.ProductStatusTableActivity;
import com.cloudsigns.factorymanager2.project.activity.ProductionScheduleActivity;
import com.cloudsigns.factorymanager2.project.activity.ProjectMapActivity;
import com.cloudsigns.factorymanager2.project.customview.DropDownPoupWindow;
import com.cloudsigns.factorymanager2.project.customview.NoscrollListView;
import com.cloudsigns.factorymanager2.project.customview.SyncHorizontalScrollView;
import com.cloudsigns.factorymanager2.project.myinerface.ItemClickListener;
import com.cloudsigns.factorymanager2.project.utils.ConstantUtil;
import com.cloudsigns.factorymanager2.project.utils.DateUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;


public class EngineeringInstallStatusTableForManagerActivity1 extends Activity implements View.OnClickListener, AdapterView.OnItemClickListener, ItemClickListener, IEngineeringInstallStatusFormanagerView {
    private View ll_op_one, ll_op_three, ll_op_four;
    private ImageView img_op_one, img_op_three, img_op_four;
    private ImageView img_tri_one,  img_tri_three, img_tri_four;
    private RelativeLayout rl_back, rl_head;
    private TextView tv_title;
    private TextView tv_head_title;

    /*表格*/
//    public static final int MODULE_TABLE = 1;
    /*状态*/
    public static final int MODULE_STATU = 2;
    /*项目选择*/
    public static final int MODULE_SELECT = 3;


//    /*表格*/
//    public static final int ORDER_INSTALL = 1;
//    /*状态*/
//    public static final int ORDER_CONSTRUCT = 2;
//    /*项目选择*/
//    public static final int ORDER_BATCH = 3;
//    /*表格*/
//    public static final int ORDER_PUBLICATION = 4;
//    /*状态*/
//    public static final int ORDER_MAINTAIN = 5;
//    /*项目选择*/
//    public static final int ORDER_SURCEY = 6;

//    private int currentOrderType = ORDER_INSTALL;


    private SyncHorizontalScrollView mHeaderHorizontal;
    private SyncHorizontalScrollView mDataHorizontal;

    /*表头 日期*/
    private LinearLayout ll_year_title;
    private NoscrollListView lvLeft;
    private NoscrollListView lvData;
    private TableLeftEngineeringInstallForManagerAdapter mLeftAdapter;
    private TableContentEngineeringInstallForManagerAdapter mDataAdapter;
    private LayoutInflater layoutInflater;
    private String TAG = EngineeringInstallStatusTableForManagerActivity1.class.getSimpleName();
    //private EngineeringOrderListForMapPresenter engineeringOrderListForMapPresenter;
    private EngineeringInstallStatusFormanagerPresenter engineeringInstallStatusFormanagerPresenter;
    private List<EngineeringInstallStatuBean> engineeringInstallStatuBeanList = new ArrayList<>();
    private HashMap<String, List<EngineeringInstallStatuBean>> feedBackStatuMap;
    private HashMap<String, List<EngineeringInstallStatuBean>> orderStatukMap;
    List<EngineeringInstallStatuBean> tableLeftDataList = new ArrayList<>();
    List<String> tableHeadDataList = new ArrayList<>();

    private String selectedProjectName = "";

    private SpinerPopWindow<String> popwindow;
    private DropDownPoupWindowAdapter popwindowAdapter;
    private List<String> popStrLs = new ArrayList<String>();

    //EngineeringInstallWorkOrderInfoForSuperFragment 工单详情  EngineeringInstallDailyFeedBackDetailActivity  反馈详情

    private DropDownPoupWindow popupWindow;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        // 沉浸式状态栏
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
            );
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);

        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        setContentView(R.layout.layout_engineeringinstall_statustable_for_manager1);

        engineeringInstallStatusFormanagerPresenter = new EngineeringInstallStatusFormanagerPresenter(this);
        init();
        getStatusTable();
    }

    private void init() {
        rl_back = findViewById(R.id.rl_back);
        tv_title = findViewById(R.id.tv_title);
        rl_head = findViewById(R.id.rl_head);
        ll_op_one = findViewById(R.id.ll_op_one);
//        ll_op_two = findViewById(R.id.ll_op_two);
        ll_op_three = findViewById(R.id.ll_op_three);
        ll_op_four = findViewById(R.id.ll_op_four);
        img_op_one = findViewById(R.id.img_op_one);
//        img_op_two = findViewById(R.id.img_op_two);
        img_op_three = findViewById(R.id.img_op_three);
        img_op_four = findViewById(R.id.img_op_four);
        img_tri_one = findViewById(R.id.img_tri_one);
//        img_tri_two = findViewById(R.id.img_tri_two);
        img_tri_three = findViewById(R.id.img_tri_three);
        img_tri_four = findViewById(R.id.img_tri_four);

        tv_title.setText("工程管理");

        img_op_one.setBackgroundResource(R.mipmap.title_icon_menu);
//        img_op_two.setBackgroundResource(R.mipmap.icon_hand);
        img_op_three.setBackgroundResource(R.mipmap.icon_produced);
        img_op_four.setBackgroundResource(R.mipmap.icon_patrol);


        ll_op_one.setVisibility(View.GONE);
//        ll_op_two.setVisibility(View.VISIBLE);
        ll_op_three.setVisibility(View.VISIBLE);
        ll_op_four.setVisibility(View.VISIBLE);
        rl_back.setVisibility(View.VISIBLE);
        rl_head.setVisibility(View.GONE);

        ll_op_one.setOnClickListener(this);
//        ll_op_two.setOnClickListener(this);
        ll_op_three.setOnClickListener(this);
        ll_op_four.setOnClickListener(this);
        rl_back.setOnClickListener(this);

        lvLeft = (NoscrollListView) findViewById(R.id.lv_left);
        lvData = (NoscrollListView) findViewById(R.id.lv_data);
        tv_head_title = findViewById(R.id.tv_head_title);


        mDataHorizontal = (SyncHorizontalScrollView) findViewById(R.id.data_horizontal);
        mHeaderHorizontal = (SyncHorizontalScrollView) findViewById(R.id.header_horizontal);

        ll_year_title = findViewById(R.id.ll_year_title);

        /*实现两个scrollview联动*/
        mDataHorizontal.setScrollView(mHeaderHorizontal);
        mHeaderHorizontal.setScrollView(mDataHorizontal);

        tv_head_title.setText("工程列表");

        mLeftAdapter = new TableLeftEngineeringInstallForManagerAdapter(this, TAG);
        mLeftAdapter.setData(tableLeftDataList);
        lvLeft.setAdapter(mLeftAdapter);

        lvLeft.setOnItemClickListener(this);

        mDataAdapter = new TableContentEngineeringInstallForManagerAdapter(this, TAG);
        mDataAdapter.setData(engineeringInstallStatuBeanList);
        mDataAdapter.setOnclickListener(this);

        lvData.setAdapter(mDataAdapter);

        popwindow = new SpinerPopWindow<String>(this, this);
        popwindowAdapter = new DropDownPoupWindowAdapter(this, TAG);
        popStrLs.add("显示全部");
        popwindowAdapter.setData(popStrLs);
        popwindow.setAdapter(popwindowAdapter);

        layoutInflater = getLayoutInflater();
    }

    private void initData() {
        if (null != engineeringInstallStatuBeanList) {
            feedBackStatuMap = new HashMap<>();
            orderStatukMap = new HashMap<>();

            feedBackStatuMap.clear();
            orderStatukMap.clear();
            tableLeftDataList.clear();
            popStrLs.clear();
            popStrLs.add("显示全部");


            for (int i = 0; i < engineeringInstallStatuBeanList.size(); i++) {
                EngineeringInstallStatuBean engineeringInstallStatuBean = engineeringInstallStatuBeanList.get(i);

                String projectName = engineeringInstallStatuBean.getProjectName();
                if (feedBackStatuMap.containsKey(projectName)) {

                    feedBackStatuMap.get(projectName).add(engineeringInstallStatuBean);
                } else {
                    List<EngineeringInstallStatuBean> engineeringInstallStatuBeanList = new ArrayList<EngineeringInstallStatuBean>();
                    engineeringInstallStatuBeanList.add(engineeringInstallStatuBean);

                    feedBackStatuMap.put(projectName, engineeringInstallStatuBeanList);
                    popStrLs.add(projectName);
                }

                if (orderStatukMap.containsKey(projectName)) {
                    orderStatukMap.get(projectName).add(engineeringInstallStatuBean);
                } else {
                    if (i == 0 && TextUtils.isEmpty(selectedProjectName))
                        this.selectedProjectName = projectName;

                    List<EngineeringInstallStatuBean> engineeringInstallStatuBeanList = new ArrayList<EngineeringInstallStatuBean>();
                    engineeringInstallStatuBeanList.add(engineeringInstallStatuBean);

                    orderStatukMap.put(projectName, engineeringInstallStatuBeanList);
                }
            }

            popwindowAdapter.setData(popStrLs);
            popwindowAdapter.notifyDataSetChanged();

            updateUi();

        }

    }

    private void updateUi() {

        if (feedBackStatuMap.size() > 0) {

            /*初始化表的左边数据*/
            tableLeftDataList.clear();
            tableLeftDataList.addAll(feedBackStatuMap.get(selectedProjectName));


            mLeftAdapter.setData(tableLeftDataList);
            mLeftAdapter.notifyDataSetChanged();


            /*初始化表头*/
            long minDate = -1;
            long maxDate = -1;
            for (int i = 0; i < tableLeftDataList.size(); i++) {
                EngineeringInstallStatuBean engineeringInstallStatuBean = tableLeftDataList.get(i);

                List<DailyFeedBackStatuBean> dailyFeedBackStatuBeanList = engineeringInstallStatuBean.getDailyFeedbackByDateList();


                if (null != dailyFeedBackStatuBeanList && dailyFeedBackStatuBeanList.size() > 0) {
                    DailyFeedBackStatuBean mindailyFeedBackStatuBean = dailyFeedBackStatuBeanList.get(0);
                    DailyFeedBackStatuBean maxdailyFeedBackStatuBean2 = dailyFeedBackStatuBeanList.get(dailyFeedBackStatuBeanList.size() - 1);


                    if (minDate == -1) {
                        minDate = DateUtil.getMillis(mindailyFeedBackStatuBean.getDateStr());
                    } else {
                        long date = DateUtil.getMillis(mindailyFeedBackStatuBean.getDateStr());
                        if (date > 0 && date < minDate)
                            minDate = date;
                    }

                    if (maxDate == -1) {
                        maxDate = DateUtil.getMillis(maxdailyFeedBackStatuBean2.getDateStr());
                    } else {
                        long date = DateUtil.getMillis(maxdailyFeedBackStatuBean2.getDateStr());
                        if (date > 0 && date > maxDate)
                            maxDate = date;
                    }
                }


            }

            tableHeadDataList.clear();

            if (minDate > 0 && maxDate > 0) {
//                    long currentDate = System.currentTimeMillis();
                int days = DateUtil.getBetweenDays(minDate, maxDate);
                if (days >= 0) {
                    if (days < 6) {
                        days = 6;
                    }
                    tableHeadDataList.clear();

                    for (int i = 0; i <= days; i++) {
                        long nextDate = minDate + i * 24 * 60 * 60 * 1000;
                        tableHeadDataList.add(DateUtil.getYyyy_Mm_Dd(nextDate));
                    }

                }
            }
            updateTableHeadUi();


            /*初始化表格内容*/
            mDataAdapter.setData(tableLeftDataList);
            mDataAdapter.setHeadData(tableHeadDataList);
            mDataAdapter.notifyDataSetChanged();
        }
    }


    private boolean isToDay(String dateStr) {
        long dayMill = System.currentTimeMillis();
        String todayDate = DateUtil.getYyyy_Mm_Dd(dayMill);
        if (todayDate.equals(dateStr))
            return true;


        return false;
    }

    /**
     * 初始化表头
     */
    private void updateTableHeadUi() {
        if (tableHeadDataList.size() > 0) {
            ll_year_title.removeAllViews();
            for (String date : tableHeadDataList) {
                View view = layoutInflater.inflate(R.layout.item_table_head_week_patrol, null);
                TextView tv_week_head = view.findViewById(R.id.tv_week_head);
                TextView tv_year_head = view.findViewById(R.id.tv_year_head);
//                TextView tv_date_head = view.findViewById(R.id.tv_date_head);
                tv_year_head.setText(date.substring(5, date.length()));
                tv_week_head.setText(DateUtil.getWeekByDateStr(date));

                if (isToDay(date)) { //今天
                    tv_year_head.setBackground(getResources().getDrawable(R.drawable.bg_white_oval));
                }


                ll_year_title.addView(view);


            }


        }
    }


    private void showportPop(View anchor) {
        if (null != popwindow)
            popwindow.dismiss();

        popwindow.setWidth(anchor.getWidth() * 2);
//        popwindow.showAsDropDown(anchor);
        popwindow.showAsDropDown(anchor, anchor.getLayoutParams().width / 2, 5);
    }


//    /**
//     * 功能2
//     *
//     * @param anchor
//     */
//    private void showEngineeringPopupWindwo(View anchor) {
//        if (null != popupWindow)
//            popupWindow.dismiss();
//        img_tri_two.setVisibility(View.VISIBLE);
//        popupWindow = new DropDownPoupWindow(this, TAG, MODULE_TABLE, R.layout.popwindow_map_for_manager_engineering, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//        // backgroundAlpha(0.4f);
//        popupWindow.setOnClickListener(this);
//        popupWindow.setCusOnDismissListener(new PopupWindow.OnDismissListener() {
//
//            @Override
//            public void onDismiss() {
//                backgroundAlpha(1f);
//                img_tri_two.setVisibility(View.GONE);
//            }
//        });
//        popupWindow.showPopupWindow(anchor, anchor.getLayoutParams().width / 2, 5);
//    }

    /**
     * 功能3
     *
     * @param anchor
     */
    private void showStatusPopupWindow(View anchor) {
        if (null != popupWindow)
            popupWindow.dismiss();

        popupWindow = new DropDownPoupWindow(this, TAG, MODULE_STATU, R.layout.popwindow_map_for_manager_status, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        // backgroundAlpha(0.4f);
        img_tri_three.setVisibility(View.VISIBLE);
        popupWindow.setOnClickListener(this);
        popupWindow.setCusOnDismissListener(new PopupWindow.OnDismissListener() {

            @Override
            public void onDismiss() {
                backgroundAlpha(1f);
                img_tri_three.setVisibility(View.GONE);
            }
        });
        popupWindow.showPopupWindow(anchor, anchor.getLayoutParams().width / 2, 5);
    }

    /**
     * 功能4
     *
     * @param anchor
     */
    private void showSelectPopupWindwo(View anchor) {
        if (null != popupWindow)
            popupWindow.dismiss();


        popupWindow = new DropDownPoupWindow(this, TAG, MODULE_SELECT, R.layout.popwindow_map_for_manager_selectproject, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        // backgroundAlpha(0.4f);
        img_tri_four.setVisibility(View.VISIBLE);
        popupWindow.setOnClickListener(this);
        popupWindow.setCusOnDismissListener(new PopupWindow.OnDismissListener() {

            @Override
            public void onDismiss() {
                backgroundAlpha(1f);
                img_tri_four.setVisibility(View.GONE);
            }
        });
        popupWindow.showPopupWindow(anchor, anchor.getLayoutParams().width / 2, 5);
    }


    /**
     * 设置添加屏幕的背景透明�?
     *
     * @param bgAlpha
     */
    private void backgroundAlpha(float bgAlpha) {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = bgAlpha;
        getWindow().setAttributes(lp);
    }


    /**
     * 根据工单类型显示状态提示对话框
     *
     * @param anchor
     */
    private void showStatusPopupWindwo(View anchor) {
        if (null != popupWindow)
            popupWindow.dismiss();

        popupWindow = new DropDownPoupWindow(EngineeringInstallStatusTableForManagerActivity1.this, "", -1, R.layout.popwindow_map_for_super_engineering_status, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        popupWindow.setOnClickListener(this);
        popupWindow.setCusOnDismissListener(new PopupWindow.OnDismissListener() {

            @Override
            public void onDismiss() {


            }
        });
        popupWindow.showPopupWindow(anchor, anchor.getLayoutParams().width / 2, 5);


//        switch (currentOrderType) {
//
//            case ORDER_INSTALL:
//                popupWindow = new DropDownPoupWindow(EngineeringInstallStatusTableForManagerActivity1.this, "", -1, R.layout.popwindow_map_for_super_engineering_status, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
//                popupWindow.setOnClickListener(this);
//                popupWindow.setCusOnDismissListener(new PopupWindow.OnDismissListener() {
//
//                    @Override
//                    public void onDismiss() {
//
//
//                    }
//                });
//                popupWindow.showPopupWindow(anchor, anchor.getLayoutParams().width / 2, 5);
//                break;
//
//        }

    }


    /**
     * 根据工单类型显示状态表
     */
    private void getStatusTable() {

        if (null != engineeringInstallStatusFormanagerPresenter)
            engineeringInstallStatusFormanagerPresenter.engineeringInstallStatusFormanager();


//        switch (currentOrderType) {
//
//            case ORDER_INSTALL:
//                if (null != engineeringInstallStatusFormanagerPresenter)
//                    engineeringInstallStatusFormanagerPresenter.engineeringInstallStatusFormanager();
//                break;
//        }


    }

    @Override
    public void onClick(View view) {
        Intent mIntent;
        switch (view.getId()) {
            case R.id.ll_op_one:
//                 showModulePopupWindow(view);
                break;
//            case R.id.ll_op_two:
//                showEngineeringPopupWindwo(view);
//                break;
            case R.id.ll_op_three:
                showStatusPopupWindow(view);
                break;
            case R.id.ll_op_four:
                showSelectPopupWindwo(view);
                break;
            case R.id.rl_back:
                finish();
                break;
            // 工程安装
            case R.id.ll_engineering_installation:
//                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, EngineeringInstallStatusTableForManagerActivity.class);
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, EngineeringInstallStatusTableForManagerActivity1.class);
                startActivity(mIntent);
                break;
            // 工程施工
            case R.id.ll_engineering_construct:
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, ProductionScheduleActivity.class);
                startActivity(mIntent);
                break;
            // 批量安装
            case R.id.ll_batch_engineering:
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, EngineeringInstallationScheduleTableActivity.class);
                startActivity(mIntent);
                break;
            // 上刊
            case R.id.ll_publication:
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, PublicationStatusTableForManagerActivity2.class);
                startActivity(mIntent);
                break;
            // 维修
            case R.id.ll_maintenance:
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, ProductStatusTableActivity.class);
                startActivity(mIntent);
                break;
            // 勘查
            case R.id.ll_survey:
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, ProductStatusTableActivity.class);
                startActivity(mIntent);
                break;
            // 勘察
            case R.id.ll_patrol:
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, PatrolStatusTableForManagerActivity.class);
                startActivity(mIntent);
                break;
        }
    }

    @Override
    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
        Intent mIntent;
        if (adapterView == lvLeft) {
            mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, ViewEngineeringInstallOrderDetailActivity.class);
            mIntent.putExtra(ConstantUtil.KEY_1, TAG);
            mIntent.putExtra(ConstantUtil.KEY_2, tableLeftDataList.get(i));
            startActivity(mIntent);
        } else {
            if (i < popStrLs.size()) {
                String pame = popStrLs.get(i);
                popwindow.dismiss();

                if (!selectedProjectName.equals(pame)) {
                    selectedProjectName = pame;
                    updateUi();
                }

            }
        }


    }

    @Override
    public void itemClick(View view, int p) {
        Intent mIntent;
        DailyFeedBackStatuBean dailyFeedBackStatuBean = (DailyFeedBackStatuBean) view.getTag();


        if (null != dailyFeedBackStatuBean && p >= 0 && p < tableLeftDataList.size()) {
            CommonEnum.FeedBackState feedBackState = dailyFeedBackStatuBean.getState();
            String dateStr = dailyFeedBackStatuBean.getDateStr();

            if (feedBackState == CommonEnum.FeedBackState.WORKING) {
            } else if (feedBackState == CommonEnum.FeedBackState.WAIT_CONFIRM) {
                mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, FeedBackSureForManagerActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, TAG);
                mIntent.putExtra(ConstantUtil.KEY_2, dailyFeedBackStatuBean);
                mIntent.putExtra("EngineeringInstallStatuBean", tableLeftDataList.get(p));
                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);

            } else if (feedBackState == CommonEnum.FeedBackState.COMPLETE) {
                mIntent = new Intent(this, EngineeringInstallCompletionFeedBackMapForManagerActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, TAG);
                mIntent.putExtra(ConstantUtil.KEY_2, dailyFeedBackStatuBean);
                mIntent.putExtra("EngineeringInstallStatuBean", tableLeftDataList.get(p));
                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);

                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);
            } else if (feedBackState == CommonEnum.FeedBackState.EXCEPTION) {
                if (!TextUtils.isEmpty(dateStr)) {
                    long feedDate = DateUtil.getMillis(dateStr);
                    if (feedDate > 0) {
                        long currentDate = System.currentTimeMillis();
                        int day = DateUtil.getBetweenDays(feedDate, currentDate);
                        if (day < 0) { //之前日期

                        } else {
                            mIntent = new Intent(EngineeringInstallStatusTableForManagerActivity1.this, FeedBackSureForManagerActivity.class);
                            mIntent.putExtra(ConstantUtil.KEY_1, TAG);
                            mIntent.putExtra(ConstantUtil.KEY_2, dailyFeedBackStatuBean);
                            mIntent.putExtra("EngineeringInstallStatuBean", tableLeftDataList.get(p));
                            startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);
                        }
                    }
                }

            } else if (feedBackState == CommonEnum.FeedBackState.CREATE) {

            } else if (feedBackState == CommonEnum.FeedBackState.NO_FEEDBACK) {

            }
        }

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (null != data) {
            switch (requestCode) {
                case ConstantUtil.START_ACTIVITY_KEY_1:
                    getStatusTable();
                    break;
            }
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void getEngineeringInstallStatusSuccessed(List<EngineeringInstallStatuBean> beanList) {
        if (null != beanList) {
            engineeringInstallStatuBeanList.clear();
            engineeringInstallStatuBeanList.addAll(beanList);
        }
        initData();

    }

    @Override
    public void getEngineeringInstallStatusFailed(String desc) {
        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }


}
